package com.tarena.lbs.marketing.web.rpc;

import com.tarena.lbs.marketing.api.MarketingApi;
import com.tarena.lbs.marketing.web.service.ActivityService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@DubboService
@Slf4j
public class MarketingApiImpl implements MarketingApi {
    @Autowired
    private ActivityService activityService;
    @Override
    public boolean activityVisible(Integer userId, Integer activityId) {
        boolean result=true;
        //默认为true 如果因为活动业务处理出现异常,文章不携带activityId
        try{
            result=activityService.isTargetConsumer(userId,activityId);
        }catch (Exception e){
            log.error("判断用户是否符合人群失败",e);
        }
        return result;
    }
}
